// pages/updateuserimg/updateuserimg.js
Page({
  data: {
  },
  onLoad: function (options) {
    // 页面初始化 options为页面跳转所带来的参数
    var yid = options.id;
    var page = this;
    wx.request({
      url: 'https://wwl.ycws.cc/ssm/uploadfile/wxselectfile?id=' + yid,
      success: function (res) {
        page.setData({ list: res.data.uploads })
        console.log(res.data)
      }
    })
  },
  onReady: function () {
    // 页面渲染完成
  },
  onShow: function () {
    // 页面显示
  },
  onHide: function () {
    // 页面隐藏
  },
  onUnload: function () {
    // 页面关闭
  },
  formSubmit: function (options) {
    var that = this;
    var listyid = options.detail.value["list.yid"];
    var listyname = options.detail.value["list.yname"];
    var listysex = options.detail.value["list.ysex"];
    var listyowner = options.detail.value["list.yowner"];
    var listyphone = options.detail.value["list.yphone"];
    var listyaddress = options.detail.value["list.yaddress"];
    var listydetailed = options.detail.value["list.ydetailed"];
    var listcreatetime = options.detail.value["list.createtime"];
    var listupdatetime = options.detail.value["list.updatetime"];
    var listyindex = options.detail.value["list.yindex"];
    var listynumber = options.detail.value["list.ynumber"];
    wx.request({
      url: 'https://wwl.ycws.cc/ssm/uploadfile/update',
      data: {
        'yid': listyid,
        'yname': listyname,
        'ysex': listysex,
        'yowner': listyowner,
        'yphone': listyphone,
        'yaddress': listyaddress,
        'ydetailed': listydetailed,
        'yindex': listyindex,
        'createtime': listcreatetime,
        'updatetime': listupdatetime,
        'ynumber': listynumber
      },
      method: 'POST', //默认为 GET 有效值：OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      header: { 'content-type': 'application/x-www-form-urlencoded' },
      success: function (res) {
        console.log(res.data.code)
        if (res.data.code == '00') {
          wx.redirectTo({
            url: '../../pages/newshowuser/newshowuser?ynumber=' + listynumber
          })
        }
      }
    })
  }
})